url = 'https://www.acwing.com/problem/content/4865/'


n,m = map(int,input().split())

day = {}


for i in range(m):
    l,r = map(int,input().split())
    for i in range(l,r+1):
        if day.get(i,False):
            day[i] += 1
        else:
            day[i] = 1
# print(day)
for i in range(1,n+1):
    if day.get(i,False):
        if day[i] > 1:
            print(i,day[i])
            break
    else:
        print(i,0)
        break
else:
    print('OK')

